jQuery(function($){

  $(document).ready(function(){
   // var box='<div id="WorkFlow-MessageBox" class="close"></div>';
   // $('body').append(box);
   // var messagebox=$('#WorkFlow-MessageBox');
  function CheckMessage()
   {
        $.ajax({
            url:'/index.php?option=com_sixeworkflow&task=menus.checknew',
            dataType: 'json'
        }
            ).done(function(data){
            if(data.count > 0)
            {
                var total=data.views;
                $('.user-avatar').find('span.total').html(data.count).show();
                for(var view in total)
                {
                    if(total[view] > 0)
                    {
                        $('.user-center-menus').find('.workflow-menu-'+view+' .total').html(total[view]).show();
                    }
                    else
                    {
                        $('.user-center-menus').find('.workflow-menu-'+view+' .total').html(total[view]).hide();
                    }
                    
                }
                
            }
            else
            {
               $('.user-avatar').find('span.total').html(data.count).hide(); 
            }

            })
   }
     CheckMessage();
     var time=window.setInterval(CheckMessage,10000);



    });
});
